package cn.nyh.test.controller;

import cn.nyh.test.domain.User;
import cn.nyh.test.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/findById")
    @ResponseBody
    public User findById(Integer uid){
        return userService.findById(uid);
    }

    @RequestMapping("/deleteById")
    @ResponseBody
    public User deleteById(Integer uid){
        return userService.deleteById(uid);
    }

    @RequestMapping("/updateById")
    @ResponseBody
    public User updateById(Integer uid){
        return userService.updateById(uid);
    }

    @RequestMapping("/add")
    @ResponseBody
    public User add(User user){
        return userService.add(user);
    }
}
